%% 
% 'a' needs to be Nx2 array, where first column is temperature, second is
% growthrate
close all
a = gr_data_MG;
T = unique(a(:,1));
A = reshape(a(:,2),[length(a)/length(T) length(T)]);

Amean = nanmean(A,1)';
Astd = nanstd(A,1)';


%% Plot data
ms = 6;
figure;
errorbar(T,Amean,Astd,'ko', 'markersize', ms, 'markerfacecolor', 'b');
set(gcf, "Position", [0 0 400 300]);
set(gca, 'FontSize', 20);
xlabel('Temperature (°C)');
ylabel('Growth rate (1/h)');
box off;


figure;
errorbar(1./(T+273),log(Amean), Astd./Amean, 'ko', 'markersize', ms, 'markerfacecolor', 'b');
set(gcf, "Position", [0 0 400 300]);
set(gca, 'FontSize', 20);
xlabel('1000/T (1/K)');
ylabel('Growth rate (1/h)');
box off;

Tmin = 25;
Tmax = 37;

Tfit = T(T<=Tmax & T>=Tmin);
Afit = Amean(T<=Tmax & T>=Tmin);

[f1,f2] = fit(1./(Tfit + 273.15), log(Afit), 'poly1')